﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Converter.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Controls/TextBlock.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/Icon.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/GeometryIcon.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/ButtonTextBox.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/FlipControl.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type controls:ElasticListBoxItem}">
        <Setter Property="Background" Value="{StaticResource LowlightBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=Foreground, Mode=OneWay}"/>
        <Setter Property="FontFamily" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=FontFamily, Mode=OneWay}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=FontSize, Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=FontStretch, Mode=OneWay}"/>
        <Setter Property="FontStyle" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=FontStyle, Mode=OneWay}"/>
        <Setter Property="FontWeight" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=FontWeight, Mode=OneWay}"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=(TextOptions.TextFormattingMode), Mode=OneWay}"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=(TextOptions.TextRenderingMode), Mode=OneWay}"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}}, Path=(RenderOptions.ClearTypeHint), Mode=OneWay}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Padding" Value="0, 0, 0, 1"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ElasticListBoxItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="SelectedStoryboard">
                            <DoubleAnimation Storyboard.TargetName="Bd"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="00:00:00.3"
                                             To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="DeselectedStoryboard">
                            <DoubleAnimation Storyboard.TargetName="Bd"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="00:00:00.3"/>
                        </Storyboard>
                        <Storyboard x:Key="MouseEnterStoryboard">
                            <DoubleAnimation Storyboard.TargetName="Bd"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="00:00:00.3"
                                             To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="MouseLeaveStoryboard">
                            <DoubleAnimation Storyboard.TargetName="Bd"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="00:00:00.3"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid Margin="{TemplateBinding Padding}">
                        <Border x:Name="Bd" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                Opacity="{TemplateBinding PercentageOpacity}"
                                SnapsToDevicePixels="True"/>
                        <ContentPresenter ClipToBounds="True" 
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="True"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
                                <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="False"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter Property="Background" Value="{StaticResource DisabledBrush}"/>
                                <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <StopStoryboard BeginStoryboardName="MouseLeaveStoryboard"/>
                                <BeginStoryboard x:Name="MouseEnterStoryboard"  
                                                 Storyboard="{StaticResource MouseEnterStoryboard}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <StopStoryboard BeginStoryboardName="MouseEnterStoryboard"/>
                                <BeginStoryboard x:Name="MouseLeaveStoryboard"  
                                                 Storyboard="{StaticResource MouseLeaveStoryboard}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Trigger.EnterActions>
                                <StopStoryboard BeginStoryboardName="DeselectedStoryboard"/>
                                <BeginStoryboard x:Name="SelectedStoryboard"  
                                                 Storyboard="{StaticResource SelectedStoryboard}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <StopStoryboard BeginStoryboardName="SelectedStoryboard"/>
                                <BeginStoryboard x:Name="DeselectedStoryboard"  
                                                 Storyboard="{StaticResource DeselectedStoryboard}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type controls:ElasticListBox}">
        <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
        <Setter Property="SelectionMode" Value="Multiple"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ElasticListBox}">
                    <Border x:Name="Bd" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <ScrollViewer Focusable="False"
                                      Margin="{TemplateBinding Padding}">
                            <ItemsPresenter x:Name="ItemsPresenter" 
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type controls:ElasticPicker}" TargetType="{x:Type controls:ElasticPicker}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultThickness), Mode=OneWay}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.TextFontSize), Mode=OneWay}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <controls:ElasticPickerGrid/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ElasticPicker}">
                    <Border x:Name="Bd" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel>
                                <Button x:Name="PART_ResetButton"
                                        Command="{TemplateBinding ResetAllCommand}"
                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                        MinWidth="0"
                                        ToolTip="Reset All">
                                    <Path Data="{StaticResource ResetGeometry}" 
                                          Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}" 
                                          Height="16"
                                          SnapsToDevicePixels="True"
                                          Stretch="Uniform"
                                          Width="16"/>
                                </Button>
                            </StackPanel>

                            <ItemsControl Grid.Column="1"
                                          Focusable="False"
                                          ItemsPanel="{TemplateBinding ItemsPanel}"
                                          ItemsSource="{Binding Path=InternalView.Groups, RelativeSource={RelativeSource TemplatedParent}}"
                                          Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsVisible}">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>

                                            <ContentControl Content="{Binding Header}"
                                                            ContentTemplate="{Binding HeaderTemplate}"
                                                            Focusable="False"
                                                            FontSize="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"
                                                            FontWeight="Normal"
                                                            Foreground="{StaticResource ForegroundBrush}"
                                                            Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
                                            <controls:Icon Grid.Column="1"
                                                           Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                           Size="Medium">
                                                <controls:Icon.Style>
                                                    <Style BasedOn="{StaticResource FilterIconStyle}" TargetType="{x:Type controls:Icon}">
                                                        <Setter Property="Visibility" Value="Visible"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding IsFilterEnabled}" Value="False">
                                                                <Setter Property="Visibility" Value="Collapsed"/>
                                                            </DataTrigger>
                                                            <DataTrigger Binding="{Binding FilterText}" Value="">
                                                                <Setter Property="Visibility" Value="Collapsed"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </controls:Icon.Style>
                                            </controls:Icon>
                                            <controls:ButtonTextBox Grid.ColumnSpan="2" 
                                                                    Command="{Binding ClearFilterCommand}"  
                                                                    Height="30"
                                                                    Padding="0"
                                                                    Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                                    Text="{Binding Path=FilterText, UpdateSourceTrigger=PropertyChanged}" 
                                                                    Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsFilterEnabled}"
                                                                    Watermark="Filter">
                                                <controls:TextBoxExtended.Style>
                                                    <Style BasedOn="{StaticResource LargeClearButtonTextBoxStyle}" TargetType="{x:Type controls:ButtonTextBox}">
                                                        <Setter Property="Focusable" Value="False"/>
                                                        <Setter Property="Opacity" Value="0"/>
                                                        <Style.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Focusable" Value="True"/>
                                                                <Trigger.EnterActions>
                                                                    <StopStoryboard BeginStoryboardName="FadeOutBeginStoryboard"/>
                                                                    <BeginStoryboard x:Name="FadeInBeginStoryboard">
                                                                        <Storyboard>
                                                                            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                                                                             Duration="00:00:00.3" 
                                                                                             To="1"/>
                                                                        </Storyboard>
                                                                    </BeginStoryboard>
                                                                </Trigger.EnterActions>
                                                                <Trigger.ExitActions>
                                                                    <StopStoryboard BeginStoryboardName="FadeInBeginStoryboard"/>
                                                                    <BeginStoryboard x:Name="FadeOutBeginStoryboard">
                                                                        <Storyboard>
                                                                            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                                                                             Duration="00:00:00.3" 
                                                                                             To="0"/>
                                                                        </Storyboard>
                                                                    </BeginStoryboard>
                                                                </Trigger.ExitActions>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </controls:TextBoxExtended.Style>
                                            </controls:ButtonTextBox>
                                            <StackPanel Grid.Column="2" 
                                                        Grid.RowSpan="2" 
                                                        HorizontalAlignment="Right"
                                                        Orientation="Horizontal"
                                                        VerticalAlignment="Top">
                                                <Button Command="{Binding SelectAllCommand}"
                                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                        MinWidth="0"
                                                        ToolTip="Select All">
                                                    <Button.Style>
                                                        <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}">
                                                            <Style.Triggers>
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                                </Trigger>
                                                                <DataTrigger Binding="{Binding IsSelectAllButtonVisible}" Value="False">
                                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Button.Style>
                                                    <Path Data="{StaticResource SelectAllGeometry}" 
                                                          Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}" 
                                                          Height="16"
                                                          SnapsToDevicePixels="True"
                                                          Stretch="Uniform"
                                                          Width="16"/>
                                                </Button>
                                                <Button Command="{Binding ResetCommand}"
                                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                        MinWidth="0"
                                                        ToolTip="Reset">
                                                    <Button.Style>
                                                        <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}">
                                                            <Style.Triggers>
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                                </Trigger>
                                                                <DataTrigger Binding="{Binding IsResetButtonVisible}" Value="False">
                                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Button.Style>
                                                    <Path Data="{StaticResource Undo1Geometry}" 
                                                          Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}" 
                                                          Height="16"
                                                          SnapsToDevicePixels="True"
                                                          Stretch="Uniform"
                                                          Width="16"/>
                                                </Button>
                                            </StackPanel>

                                            <controls:ElasticListBox x:Name="ElasticListBox" 
                                                                     Grid.ColumnSpan="3"
                                                                     Grid.Row="1"
                                                                     ItemsSource="{Binding EntitiesView}">
                                                <controls:ElasticListBox.ItemContainerStyle>
                                                    <Style BasedOn="{StaticResource {x:Type controls:ElasticListBoxItem}}"
                                                           TargetType="{x:Type controls:ElasticListBoxItem}">
                                                        <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
                                                        <Setter Property="IsHighlighted" Value="{Binding IsEnabled}"/>
                                                        <Setter Property="IsSelected" Value="{Binding IsSelected}"/>
                                                        <Setter Property="MaxHeight" Value="{Binding Path=DataContext.MaxHeight, RelativeSource={RelativeSource AncestorType={x:Type controls:ElasticListBox}}}"/>
                                                        <Setter Property="MinDisabledHeight" Value="{Binding Path=DataContext.MinDisabledHeight, RelativeSource={RelativeSource AncestorType={x:Type controls:ElasticListBox}}}"/>
                                                        <Setter Property="MinEnabledHeight" Value="{Binding Path=DataContext.MinEnabledHeight, RelativeSource={RelativeSource AncestorType={x:Type controls:ElasticListBox}}}"/>
                                                        <Setter Property="ToolTip">
                                                            <Setter.Value>
                                                                <ToolTip>
                                                                    <Grid>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"/>
                                                                            <ColumnDefinition Width="Auto"/>
                                                                        </Grid.ColumnDefinitions>

                                                                        <ContentControl Content="{Binding Content}"
                                                                                        ContentTemplate="{Binding ContentTemplate}"
                                                                                        ContentTemplateSelector="{Binding ContentTemplateSelector}"
                                                                                        Focusable="False"/>

                                                                        <TextBlock Grid.Column="1"
                                                                                   Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                                                   VerticalAlignment="Center">
                                                                            <TextBlock.Text>
                                                                                <MultiBinding StringFormat="{}{0}/{1}">
                                                                                    <Binding Path="Value"/>
                                                                                    <Binding Path="Total"/>
                                                                                </MultiBinding>
                                                                            </TextBlock.Text>
                                                                        </TextBlock>

                                                                    </Grid>
                                                                </ToolTip>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
                                                        <Setter Property="Value" Value="{Binding Value}"/>
                                                    </Style>
                                                </controls:ElasticListBox.ItemContainerStyle>
                                                <controls:ElasticListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Grid>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*"/>
                                                                <ColumnDefinition Width="Auto"/>
                                                            </Grid.ColumnDefinitions>

                                                            <ContentControl Content="{Binding Content}"
                                                                            ContentTemplate="{Binding ContentTemplate}"
                                                                            Focusable="False"
                                                                            Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                                            Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsEnabled}"/>

                                                            <TextBlock Grid.Column="1" 
                                                                       Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                                                       Text="{Binding DisplayValue}"
                                                                       TextAlignment="Right"
                                                                       VerticalAlignment="Center">
                                                                <TextBlock.Style>
                                                                    <Style TargetType="{x:Type TextBlock}">
                                                                        <Style.Triggers>
                                                                            <DataTrigger Binding="{Binding Group.IsCountVisible}" Value="False">
                                                                                <Setter Property="Visibility" Value="Collapsed"/>
                                                                            </DataTrigger>
                                                                            <DataTrigger Binding="{Binding IsEnabled}" Value="False">
                                                                                <Setter Property="Visibility" Value="Collapsed"/>
                                                                            </DataTrigger>
                                                                        </Style.Triggers>
                                                                    </Style>
                                                                </TextBlock.Style>
                                                            </TextBlock>

                                                        </Grid>
                                                    </DataTemplate>
                                                </controls:ElasticListBox.ItemTemplate>
                                            </controls:ElasticListBox>

                                        </Grid>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>

                            <controls:FlipControl x:Name="PART_FlipControl"
                                                  Grid.Column="1"
                                                  HorizontalAlignment="Center"
                                                  Focusable="False"
                                                  IsHitTestVisible="False"
                                                  Style="{StaticResource FadeFlipControl}"
                                                  VerticalAlignment="Center">
                                <controls:FlipControl.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock FontSize="72" 
                                                   Style="{StaticResource HeaderTextStyle}"
                                                   Text="{Binding}"
                                                   VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </controls:FlipControl.ItemTemplate>
                            </controls:FlipControl>

                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsResetButtonVisible" Value="False">
                            <Setter Property="Visibility" TargetName="PART_ResetButton" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>